package com.longge;

/**
 * @program: my-code
 * @description:
 * @author: longge
 * @create: 2021-05-24 00:21
 */
public class CheckZeroOnes {
    public boolean checkZeroOnes(String s) {
        char[] chars = s.toCharArray();
        int one = 0;
        int zero = 0;
        int maxOne = 0;
        int maxZero = 0;
        for (char aChar : chars) {
            if (aChar == '1') {
                one++;
                maxOne = Math.max(one, maxOne);
                zero = 0;
            } else {
                zero++;
                maxZero = Math.max(zero, maxZero);
                one = 0;
            }
        }
        return maxOne > maxZero;
    }
}
